// @algorithm @lc id=100320 lang=cpp
// @title shu-zu-zhong-shu-zi-chu-xian-de-ci-shu-lcof

#include "algm/algm.h"
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Solution {
public:
    vector<int> singleNumbers(vector<int> &nums) {
        int temp = 0;
        for (auto &num : nums) {
            temp ^= num;
        }
        int div = 1;
        while ((temp & div) == 0) {
            div <<= 1;
        }
        int a = 0, b = 0;
        for (auto &num : nums) {
            if (num & div) {
                a ^= num;
            }
            else {
                b ^= num;
            }
        }
        return vector<int>{a, b};
    }
};